﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
namespace Fei
{

    public class ProgressCtrl : MonoBehaviour
    {
        private int totalQuestion; //总共有多少题
        private int answerQuestion; //现在在第几题
        public Text questionNumber;
        public Image bar;
        static public bool completeQuestion;
        public GameObject success;
        void Start()
        {
            completeQuestion = false; //预留，过了一关
            totalQuestion = 10;
            answerQuestion = 1;
        }

        void Update()
        {
            if (completeQuestion)
            {
                answerQuestion++;
                completeQuestion = false;
            }

            if(answerQuestion > totalQuestion)
            {
                success.SetActive(true);
            }
            else
            {
                questionNumber.text = answerQuestion + " / " + totalQuestion; //修改文本
                bar.fillAmount = (float)answerQuestion / (float)totalQuestion; //修改进度条
            }
        }

        public void PressSuccess()
        {
            SceneManager.LoadScene("zhen-test");
        }
    }
}
